//使用指针访问数组中的元素
#include <stdio.h>

int main(void)
{
	int arr[5] = {11,22,33,44,55};
	int* p = arr;
	int i = 0;
	for(i = 0; i < 5; i++)
	{
		//printf("arr[%d] = %d\n",i,arr[i]);
		// arr[0] => *(arr+0)
		// arr[1] => *(arr+1)
		// arr[i] => *(arr+i)
		printf("&arr[%d] = %p\n",i,&arr[i]);
		//printf("arr+%d = %p\n",i,arr+i);
		//printf("arr[%d] = %d\n",i,*(arr+i));
		//printf("arr[%d] = %d\n",i,*(i+arr));
		//仅供娱乐 i[arr] => *(i+arr)
		//printf("arr[%d] = %d\n",i,i[arr]);
		//printf("arr[%d] = %d\n",i,p[i]);
		//printf("arr[%d] = %d\n",i,i[p]);
		//printf("arr[%d] = %d\n",i,*(p+i));
		//printf("arr[%d] = %d\n",i,*(i+p));
		//printf("arr[%d] = %d\n",i,*p);
		p++;
		//printf("arr[%d] = %d\n",i,*p++);
		// arr的值不可改变
		//printf("arr[%d] = %d\n",i,*arr++);
	}

	printf("-----------------------\n");
	printf("arr = %p,p = %p\n",arr,p);
	p--;
	printf("p = %p\n",p);
	return 0;
}
